package cn.iocoder.yudao.module.search.api.search.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import java.util.List;

/**
 * RPC 服务 - 搜索批量操作 Request DTO
 *
 * @author 芋道源码
 */
@Schema(description = "RPC 服务 - 搜索批量操作 Request DTO")
@Data
public class SearchBulkReqDTO {



    @Schema(description = "星球ID", example = "1001")
    private Long planetId;

    @Schema(description = "索引名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "user_index")
    @NotBlank(message = "索引名称不能为空")
    private String indexName;

    @Schema(description = "批量操作列表", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "批量操作列表不能为空")
    private List<BulkOperation> operations;

    @Schema(description = "批量操作")
    @Data
    public static class BulkOperation {

        @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "index")
        @NotBlank(message = "操作类型不能为空")
        private String operation; // index, create, update, delete

        @Schema(description = "文档ID", example = "1")
        private String documentId;

        @Schema(description = "文档内容", example = "{\"name\":\"张三\",\"age\":25}")
        private Object document;

    }

}
